package com.bolt.support.spring.jpa.entity;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;


@Getter
@Setter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class BaseTreeAuditingEntity<ID extends Serializable,T extends BaseTreeAuditingEntity> extends BaseTreeEntity<ID,T> {

    /**
     * 创建人
     */
    @CreatedBy
    @Column(name = "create_by", updatable = false)
    private String createBy;

    /**
     * 更新人
     */
    @LastModifiedBy
    @Column(name = "update_by")
    private String updateBy;

    /**
     * 创建时间
     */
    @CreatedDate
    @Column(name = "create_date", updatable = false)
    private Date createDate;

    /**
     * 更新时间
     */
    @LastModifiedDate
    @Column(name = "update_date")
    private Date updateDate;


}

 